import torch
"""dim控制拼接的维度，dim=0为上下拼接，dim=1为左右拼接"""

a = torch.rand((2,3))
b = torch.rand((2,3))

c = torch.cat((a,b),dim=0) #上下拼接
print(c)
print("-----------------------------")
d = torch.cat((a,b),dim=1)  # 左右拼接
print(d)
print("-----------------------------")
e = torch.cat((a,b))  #默认维度为0
print(e)












